package com.home.rest;

import com.github.pagehelper.PageInfo;
import com.home.base.msg.ObjectRestResponse;
import com.home.base.msg.TableResultResponse;
import com.home.base.rest.BaseRestController;
import com.home.biz.JobUserBiz;
import com.home.entity.JobUser;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ：chenxf
 * @date ：Created in 2019/6/19 10:29
 * @description：
 * @modified By：
 * @version: $
 */
@RestController
@RequestMapping("jobUser")
public class JobUserController extends BaseRestController<JobUserBiz, JobUser> {

    @GetMapping("/list")
    public TableResultResponse<JobUser> list(int limit, int offset) {
        //  this.getCurrentId();//检验权限
        List<JobUser> items = baseBiz.list(limit,offset);
        PageInfo<JobUser> pageInfo = new PageInfo<>(items);
        return new TableResultResponse<JobUser>(Integer.parseInt(String.valueOf(pageInfo.getTotal())),
                limit, offset,
                items);
    }

    @RequestMapping(value = "/save", method = RequestMethod.POST)
    @ResponseBody
    public ObjectRestResponse save(JobUser entity){
        baseBiz.insertSelective(entity);
        return new ObjectRestResponse("保存成功").rel(true);
    }
}
